//import java.io.*;
//
//public class Test5 {
//    public static void main(String[] args) throws IOException {
//        String fileName = "D:\\Java\\Hello.txt";
//
//        String line;
//
//        try {
//            BufferedReader in = new BufferedReader(new FileReader(fileName));//in为读取文件中内容
//
//            line = in.readLine();
//            while (line != null) {
//                System.out.println(line);
//                line = in.readLine();
//            }
//            in.close();
//        } catch (IOException e) {
////            System.out.println("Program reading " + fileName);
//            e.printStackTrace();
//        }
//    }
//}

import java.io.*;

public class Test5 {
    public static void main(String[] args) throws IOException {
        String fileName = "D:\\Java\\Hello.txt";

        String line;

        try {
            BufferedReader in = new BufferedReader(new FileReader(fileName));//in为读取文件中内容

            line = in.readLine();
            while (line != null) {
                System.out.println(line);
                line = in.readLine();
            }

//            int c;
//            while ((c = in.read()) != -1) {
//                System.out.println((char) c);//一个字符占一行
//            }
            in.close();
        } catch (IOException e) {
//            System.out.println("Program reading " + fileName);
            e.printStackTrace();
        }
    }
}
